/**
ysbErPatch.mg
*/


class YSBHomeController:YSBViewController {

- (void)viewDidAppear:(BOOL)animated {
    super.viewDidAppear:(animated);
    YSBMSAlertManager.shareManager().showAlerts();
    self.performSelector:withObject:afterDelay:(@selector(delayMethod),nil,2.5);
    
}


- (void)delayMethod {
    YSBMSAlertManager.shareManager().showAlerts();
}



}



class YSBMineController : YSBViewController {


- (void)viewDidAppear:(BOOL)animated {
    super.viewDidAppear:(animated);
    YSBMSAlertManager.shareManager().showAlerts();
}


}



class AppDelegate:UIResponder {

- (void)openProtectionsAction {
    self.openAvoidCrashAction();

}

- (void)closeWebSocket {
    YSBWebSocketManager.shared().webSocketClose();
    YSBChatRoomWebSocketManager.shared().webSocketClose();
}


- (void)openWebSocket {
    if (YSBUserDefaultsTool.boolForKey:(@"kIsLoginSuccess")) {
        YSBWebSocketManager.shared().webSocketClose();
        YSBWebSocketManager.shared().connectServer();
        
        YSBChatRoomWebSocketManager.shared().webSocketClose();
        YSBChatRoomWebSocketManager.shared().connectServer();
    }
    
}


}



class YSBOrderDetailViewController:YSBViewController {


- (void)shareOrderWithTitle:(NSString *)title andDesc:(NSString *)desc andUrlStr:(NSString *)shareUrl {

    NSString *uid = @"";
    
    NSURL *url = YSBChatRoomWebSocketManager.shared().webScoket.url;
    NSString *urlStr = url.absoluteString();
    NSString *sepKey = @"uid=";
    if (urlStr.containsString:(sepKey)) {
        NSArray *arr = urlStr.componentsSeparatedByString:(sepKey);
        if (arr.count > 1) {
            uid = arr[1];
        }
    }
    NSString *tempStr = shareUrl.stringByAppendingString:(@"&share_uid=");
    NSString *shareAllUrl = tempStr.stringByAppendingString:(uid);

    self.goToShareActionWithTitle:andDesc:andUrlStr:(title,desc,shareAllUrl);
    
}


}



class YSBSecurityFenceStateViewController : YSBViewController {

- (void)configurationUI {
    NSNotificationCenter.defaultCenter().addObserver:selector:name:object:(self,@selector(loadData),@"webSocketPushMsgNotification",nil);

    self.tableView();
    
    self.dataArr = NSMutableArray.alloc().init();
    self.refreshHeader = MJRefreshNormalHeader.headerWithRefreshingTarget:refreshingAction:(self,@selector(loadData));
    self.tableView.mj_header = self.refreshHeader;
    
}


}



class YSBMainADScrollView : UIView {

- (UIButton *)leftBtn {
    if (!_leftBtn) {
        _leftBtn = UIButton.alloc().init();
        _leftBtn.setBackgroundImage:forState:(YSBCommonTool.autoreleasepoolWithImageName:(@"adBox_left"),UIControlStateNormal);
        _leftBtn.addTarget:action:forControlEvents:(self,@selector(leftBtnAction:),UIControlEventTouchUpInside);
        _leftBtn.hidden = self.dataSourse.count < 2 ? YES : NO;
    }
    return _leftBtn;
}

- (UIButton *)rightBtn{
    if (!_rightBtn) {
        _rightBtn = UIButton.alloc().init();
        _rightBtn.setBackgroundImage:forState:(YSBCommonTool.autoreleasepoolWithImageName:(@"adBox_right"),UIControlStateNormal);
        _rightBtn.addTarget:action:forControlEvents:(self,@selector(rightBtnAction:),UIControlEventTouchUpInside);
        _rightBtn.hidden = self.dataSourse.count < 2 ? YES : NO;
    }
    return _rightBtn;
}


}



class YSBRecordCell : UITableViewCell {


- (void)setModel:(YSBRecordModel *)model {
    _model = model;
    if (self.recordType == 0) {
        
        self.typeLabel.text = @"提现";
        
        NSMutableString *mutStr = NSMutableString.alloc().initWithString:(@"-");
        mutStr.appendString:(model.total);
        self.moneyLabel.text = mutStr;
        
    }
    else if (self.recordType == 2) {
        
        self.typeLabel.text = YSBCommonTool.isBlankString:(model.type) ? @"" : model.type;
                
        NSMutableString *mutStr = NSMutableString.alloc().initWithString:(model.flag);
        mutStr.appendString:(model.money);
        self.moneyLabel.text = mutStr;
        
    }
    else if (self.recordType == 1) {
        
        self.typeLabel.text = @"充值";
        
        NSMutableString *mutStr = NSMutableString.alloc().initWithString:(@"+");
        mutStr.appendString:(model.money);
        self.moneyLabel.text = mutStr;
        
    }
    self.timeLabel.text = model.created_at;
    self.statusLabel.text = model.status;
}


}
